﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Gnosis.Babel;
using Gnosis.SQLite.Numeric;
using Gnosis.SQLite.Predicates;

namespace Gnosis.SQLite
{
    public abstract class NumericValue
        : Value, INumeric
    {
        protected NumericValue(string prefix)
            : base(prefix)
        {
        }

        protected NumericValue(string prefix, string infix, string postfix)
            : base(prefix, infix, postfix, new List<IExpression>())
        {
        }

        protected NumericValue(string infix, IExpression left, IExpression right)
            : base(infix, left, right)
        {
        }

        protected NumericValue(string prefix, string infix, string postfix, IList<IExpression> expressions)
            : base(prefix, infix, postfix, expressions)
        {
        }

        #region INumeric Members

        public INumericColumnName As(string alias)
        {
            return new NumericColumnName(ToString(), alias);
        }

        public IPredicate Between(INumeric start, INumeric end)
        {
            return new Between(this, start, end);
        }

        public IPredicate GreaterThan(INumeric value)
        {
            return new GreaterThan(this, value);
        }

        public IPredicate GreaterThanOrEqualTo(INumeric value)
        {
            return new GreaterThanOrEqualTo(this, value);
        }

        public IPredicate LessThan(INumeric value)
        {
            return new LessThan(this, value);
        }

        public IPredicate LessThanOrEqualTo(INumeric value)
        {
            return new LessThanOrEqualTo(this, value);
        }

        public INumeric Multiply(INumeric value)
        {
            return new Multiply(this, value);
        }

        #endregion
    }
}
